{template '_header'}
<style type="text/css">
    .pd0{padding:0;}
    .trhead td {  background:#efefef;text-align: center}
    .trbody td {  text-align: center; vertical-align:top;border-left:1px solid #f2f2f2;overflow: hidden; font-size:12px;}
    .trorder { background:#f8f8f8;border:1px solid #f2f2f2;text-align:left;}
    .ops { border-right:1px solid #f2f2f2; text-align: center;}
</style>
<div class="page-heading">
    <h2>订单管理 <small>数量: <span class='text-danger'>{$total}</span> 条</small></h2>
</div>
<div class="main">
    <form action="./index.php" method="get" class="form-horizontal table-search" role="form">
        <input type="hidden" name="c" value="site" />
        <input type="hidden" name="a" value="entry" />
        <input type="hidden" name="m" value="ewei_shopv2" />
        <input type="hidden" name="do" value="web" />
        <input type="hidden" name="r"  value="groups.verify" />
        <input type="hidden" name="status"  value="{$_GPC['status']}" />
        <div class="page-toolbar row m-b-sm m-t-sm">
            <div class="col-sm-7">
                <div class="btn-group btn-group-sm" style='float:left'>
                    <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                    <select name="paytype" class="form-control input-sm select-md" style="width:85px;padding:0;">
                        <option value="" {if $_GPC['paytype']==''}selected{/if}>支付方式</option>
                        {loop $paytype $key $type}
                        <option value="{$key}" {if $_GPC['paytype'] == "$key"} selected="selected" {/if}>{$type}</option>
                        {/loop}
                    </select>
                    <select name='searchtime' class='form-control  input-sm select-md' style="width:85px;padding:0;"  >
                        <option value=''>不按时间</option>
                        <option value='create' {if $_GPC['searchtime']=='create'}selected{/if}>下单时间</option>
                        <option value='pay' {if $_GPC['searchtime']=='pay'}selected{/if}>付款时间</option>
                        <option value='send' {if $_GPC['searchtime']=='send'}selected{/if}>发货时间</option>
                        <option value='finish' {if $_GPC['searchtime']=='finish'}selected{/if}>完成时间</option>
                    </select>
                    {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
                </div>
            </div>
            <div class="col-sm-5 pull-right">
                <select name='searchfield'  class='form-control  input-sm select-md'   style="width:95px;padding:0 5px;"  >
                    <option value='orderno' {if $_GPC['searchfield']=='orderno'}selected{/if}>订单号</option>
                    <option value='member' {if $_GPC['searchfield']=='member'}selected{/if}>会员信息</option>
                    <option value='goodstitle' {if $_GPC['searchfield']=='goodstitle'}selected{/if}>商品名称</option>
                    <option value='goodssn' {if $_GPC['searchfield']=='goodssn'}selected{/if}>商品编码</option>
                    <option value='saler' {if $_GPC['searchfield']=='saler'}selected{/if}>核销员</option>
                    <option value='store' {if $_GPC['searchfield']=='store'}selected{/if}>核销门店</option>
                </select>
                <div class="input-group">
                    <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键词"/>
                <span class="input-group-btn">
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                    <button type="submit" name="export" value="1" class="btn btn-success btn-sm">导出</button>
                </span>
                </div>
            </div>
        </div>
    </form>
    {if count($list)>0}
    <table class='table table-responsive' style='table-layout: fixed;'>
        <tr style='background:#f8f8f8'>
            <td style='width:60px;border-left:1px solid #f2f2f2;'>商品</td>
            <td style='width:150px;'></td>
            <td style='width:70px;text-align: right;;'>单价/数量</td>
            <td  style='width:100px;text-align: center;'>买家</td>
            <td style='width:100px;text-align: center;'>支付/配送/退款</td>
            <td style='width:100px;text-align: center;'>金额</td>
            <td style='width:100px;text-align: center;'>下单时间</td>
            <td style='width:90px;text-align: center'>状态</td>
        </tr>
        {loop $list $item}
        <tr ><td colspan='8' style='height:20px;padding:0;border-top:none;'>&nbsp;</td></tr>
        <tr class='trorder'>
            <td colspan='4' >
                订单编号:  {$item['orderno']}
            </td>
            <td colspan='4' style='text-align:right;font-size:12px;' class='aops'>
                {if $item['status'] >= 0 && $item['status'] < 3 }
                {ifp 'groups.verify.close'}
                <a class='op'  data-toggle='ajaxModal' href="{php echo webUrl('groups/order/close',array('id'=>$item['id']))}" >关闭订单</a>
                {/if}
                {/if}
                <a class='op'  href="{php echo webUrl('groups/verify/detail', array('orderid' => $item['id']))}" >查看详情</a>
                {if !empty($item['expresssn']) && $item['status']>=2 && !empty($item['addressid'])}
                <a class='op' data-toggle="ajaxModal" href="{php echo webUrl('util/express', array('id' => $item['id'],'express'=>$item['express'],'expresssn'=>$item['expresssn']))}">查看物流</a>
                {/if}
                {ifp 'groups.verify.remarksaler'}
                <a class='op'  data-toggle="ajaxModal" href="{php echo webUrl('groups/order/remarksaler', array('id' => $item['id']))}" {if !empty($item['note'])}style='color:red'{/if} >备注</a>
                {/if}
            </td>
        </tr>
        <tr class='trbody'>
            <td style='overflow:hidden;'><img src="{php echo tomedia($item['thumb'])}" style='width:50px;height:50px;border:1px solid #ccc; padding:1px;'></td>
            <td style='text-align: left;overflow:hidden;border-left:none;'>{$item['title']}</td>
            <td style='text-align:right;border-left:none;'>
                ¥ {if $item['is_team']==1}{$item['groupsprice']}{else}{$item['singleprice']}{/if}
                <br/>x1
            </td>
            <td  style='text-align: center;' >
                {ifp 'member.member.edit'}
                <a href="{php echo webUrl('member/list/detail',array('id'=>$item['mid']))}"> {$item['nickname']}</a>
                {else}
                {$item['nickname']}
                {/if}
                <br/>
                {$item['mrealname']}<br/>{$item['mmobile']}</td>
            <td style='text-align:center;' >
                {if $item['pay_type']=='wechat'}
                <span class='label label-danger'>微信支付</span>
                {elseif $item['pay_type']=='credit'}
                <span class='label label-danger'>余额支付</span>
                {elseif $item['pay_type']=='alipay'}
                <span class='label label-danger'>支付宝支付</span>
                {elseif $item['pay_type']=='other'}
                <span class='label label-default'>其他</span>
                {elseif $item['pay_type']==''}
                <span class='label label-default'>未付款</span>
                {/if}
                <br />
                <span style="margin-top:5px;display:block;">
                    {if $item['isverify'] == 1}
                    线下核销
                    {elseif !empty($item['addressid'])}
                    快递
                    {elseif !empty($item['isvirtualsend']) || !empty($item['virtual'])}
                    自动发货{if !empty($item['isvirtualsend'])}(虚拟物品){else}(虚拟卡密){/if}
                    {elseif $item['dispatchtype']}
                    自提
                    {else}
                    其他
                    {/if}
                </span>
                {if $item['refundtime']}
                <span class='label label-default'>已退款</span>
                {/if}
            </td>
            <td style='text-align:center' >
                ¥ {php echo number_format($item['price']-$item['creditmoney']+$item['freight'],2)}
                <a data-toggle='popover' data-html='true' data-placement='top' data-content="<table style='width:100%;'>
                <tr>
                    <td  style='border:none;text-align:right;'>商品小计：</td>
                    <td  style='border:none;text-align:right;;'>
                        ¥ {php echo number_format($item['price'] + $item['discount'],2)}
                    </td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>运费：</td>
                    <td  style='border:none;text-align:right;;'>¥ {php echo number_format( $item['freight'],2)}</td>
                </tr>
                {if $item['discount']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>团长优惠：</td>
                    <td  style='border:none;text-align:right;'>- ¥{$item['discount']}</td>
                </tr>
                {/if}
                {if $item['discountprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>会员折扣：</td>
                    <td  style='border:none;text-align:right;;'>-¥ {php echo number_format( $item['discountprice'],2)}</td>
                </tr>
                {/if}
                {if $item['creditmoney']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>积分抵扣：</td>
                    <td  style='border:none;text-align:right;;'>-¥ {php echo number_format( $item['creditmoney'],2)}</td>
                </tr>
                {/if}
                {if $item['deductenough']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>满额立减：</td>
                    <td  style='border:none;text-align:right;;'>-¥ {php echo number_format( $item['deductenough'],2)}</td>
                </tr>
                {/if}
                {if $item['couponprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>优惠券优惠：</td>
                    <td  style='border:none;text-align:right;;'>-¥ {php echo number_format( $item['couponprice'],2)}</td>
                </tr>
                {if $item['isdiscountprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>促销优惠：</td>
                    <td  style='border:none;text-align:right;;'>-¥ {php echo number_format( $item['isdiscountprice'],2)}</td>
                </tr>
                {/if}
                {/if}
                {if intval($item['changeprice'])!=0}
                <tr>
                    <td  style='border:none;text-align:right;'>卖家改价：</td>
                    <td  style='border:none;text-align:right;;'>
                    <span style='{if 0<$item['changeprice']}color:green{else}color:red{/if}'>
                    {if 0<$item['changeprice']}+{else}-{/if}¥ {php echo number_format(abs($item['changeprice']),2)}
                    </span>
                    </td>
                </tr>
                {/if}
                {if intval($item['changedispatchprice'])!=0}
                <tr>
                    <td  style='border:none;text-align:right;'>卖家改运费：</td>
                    <td  style='border:none;text-align:right;;'>
                        <span style='{if 0<$item['changedispatchprice']}color:green{else}color:red{/if}'>
                        {if 0<$item['changedispatchprice']}+{else}-{/if}¥ {php echo abs($item['changedispatchprice'])}
                        </span>
                    </td>
                </tr>
                {/if}
                <tr>
                    <td style='border:none;text-align:right;'>应收款：</td>
                    <td style='border:none;text-align:right;color:green;'>¥ {php echo number_format($item['price']-$item['creditmoney']+$item['freight'],2)}</td>
                </tr>
            </table>">
                    <i class='fa fa-question-circle'></i></a>
                {if $item['freight']>0}
                <br/>(含运费:¥ {php echo number_format( $item['freight'],2)})
                {/if}
            </td>
            <td style='text-align:center' >
                {php echo date('Y-m-d',$item['createtime'])}<br/>{php echo date('H:i:s',$item['createtime'])}
            </td>
            <td  class='ops' style='line-height:20px;text-align:center' >
                {if $item['status'] == 0}<span class='text-danger'>待付款</span>{/if}
                {if $item['status'] == 1}<span class='text-navy'>已付款</span>{/if}
                {if $item['deleted'] == 1}
                <span class='text-default'>用户已删除</span>
                {else}
                {if $item['status'] == 3}<span class='text-success'>已完成</span>{/if}
                {if $item['status'] == -1}<span class='text-default'>已取消</span>{/if}
                {/if}
                <br />
                {if $item['isverify']==1 && $item['status'] == 1}
                <!--核销 确认核销-->
                {ifp 'order.op.verify'}
                <a class="btn btn-primary btn-xs" style="display: none;" data-toggle='ajaxPost' href="{php echo webUrl('groups/verify/fetch', array('id' => $item['id']))}" data-confirm="确认使用吗？">确认使用</a>
                {/if}
                {/if}
            </td>
        </tr>
        <tr style="border-bottom:none;background:#f9f9f9;">
            <td colspan='8' style='text-align:left;height:0;padding:0'></td>
        </tr>
        {/loop}
    </table>
    <div style="text-align:right;width:100%;">
        {$pager}
    </div>
    {else}
    <div class='panel panel-default'>
        <div class='panel-body' style='text-align: center;padding:30px;'>
            暂时没有任何订单!
        </div>
    </div>
    {/if}
</div>
{template '_footer'}